package com.wxh.multithread;

/**
 * @ClassName: TestJoin
 * @Description:
 * @Author wxh
 * @Date: 2021/12/30 14:15
 * @Version V1.0.0
 * @Since 1.8
 */
public class TestJoin implements Runnable {
    public static void main(String[] args) throws InterruptedException {
        // 启动资金定义线程
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();

        // 主线程
        for (int i = 0; i < 500; i++) {
            if(i == 200){
                // 插队到当前线程的前面执行，强制执行
                thread.join();
            }
            System.out.println("main " + i);
        }
    }


    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("线程VIP来了" + i);
        }
    }
}
